(function () {
  'use strict';

  function _typeof(obj) {
    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
      _typeof = function (obj) {
        return typeof obj;
      };
    } else {
      _typeof = function (obj) {
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      };
    }

    return _typeof(obj);
  }

  function $AppConfig (Vue, options) {
    function getFormData(formData) {
      var data = '';

      for (var key in formData) {
        data += '&' + key + '=' + encodeURIComponent(formData[key] instanceof Object ? JSON.stringify(formData[key]) : formData[key]);
      }

      return data.substring(1);
    }

    var params = {}; //url参数列表

    window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) {
      params[key] = decodeURI(value);
    });
    var getToken = params.access_token;
    var inApp = !!getToken;
    var INTERFACE_HOST = 'http://www.hncwaxxkj.cn:9001'; //本地调试 使用mock搭建静态数据服务

    var isIos = /ipod|ipad|iphone|mac os x/i.test(navigator.userAgent);

    Date.prototype.format = function (format) {
      var o = {
        'M+': this.getMonth() + 1,
        //month
        'd+': this.getDate(),
        //day
        'h+': this.getHours(),
        //hour
        'm+': this.getMinutes(),
        //minute
        's+': this.getSeconds(),
        //second
        'q+': Math.floor((this.getMonth() + 3) / 3),
        //quarter
        'S': this.getMilliseconds() //millisecond

      };

      if (/(y+)/i.test(format)) {
        format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
      }

      for (var k in o) {
        if (new RegExp('(' + k + ')').test(format)) {
          format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
        }
      }

      return format;
    };

    Vue.$AppConfig = Object.assign({
      urlParams: params,
      inApp: inApp,
      isIos: isIos,
      INTERFACE_HOST: INTERFACE_HOST,
      getToken: getToken,
      getFormData: getFormData,
      appJSBridge: function appJSBridge(key, message) {
        if (_typeof(window.JsBridge) == 'object' && typeof window.JsBridge[key] == 'function') {
          message == undefined ? window.JsBridge[key]() : window.JsBridge[key](message);
          return true;
        } else if (_typeof(window.webkit) == 'object') {
          try {
            message == undefined ? window.webkit.messageHandlers[key].postMessage('') : window.webkit.messageHandlers[key].postMessage(message);
            return true;
          } catch (e) {
            console.log(e);
            return false;
          }
        } else {
          return false;
        }
      }
    }, typeof options === 'function' ? options() : options);
  }

  Vue.use($AppConfig, {});
  var vm = new Vue({
    el: '#detail',
    data: {
      state: true,
      title: ''
    },
    computed: {},
    methods: {
      black: function black() {
        location.href = "./index.html";
      }
    },
    mounted: function mounted() {
      //  获取url参数
      var params = Vue.$AppConfig.urlParams; // 请求

      this.$http.get(Vue.$AppConfig.INTERFACE_HOST + '/getLineStation.php', {
        params: {
          lineId: params.lineId
        }
      }, {
        emulateJSON: true
      }).then(function (response) {
        var body = response.body;
        console.log(body);
      })["catch"](function (e) {// 请求失败
      });
    }
  });

}());
